home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / switcher / 9650grab.rexx next >
OS/2 REXX Batch file  |  1993-12-13  |  3KB  |  133 lines

  1. /* Grab frames on Sony9 EVO-9650 */
  2. /* Set serial at 9600 8N1 */
  3. /* Wed Nov  4 13:00:21 1992 */
  4.  
  5. arg timecode count name
  6.  
  7. StartupCmd="56DFC83240" /* DNR Mode */
  8.  
  9. cmdnum=1
  10.  
  11.  
  12. NextFrame=x2c("2B")
  13.  
  14. OPTIONS RESULTS
  15. TOASTERLIB="ToasterARexx.port"
  16.  
  17. if arg()=0 then do
  18.   say "USAGE: rx 9650Grab <Start Time Code> <# of frames> <name>"
  19.   exit
  20. end
  21.  
  22. if count="" then count=10
  23. if count>1000 then count=1000
  24. if name="" then name=left(date(),6)
  25. name=strip(name)
  26. IF POS(TOASTERLIB , SHOW('Libraries')) = 0 THEN
  27.   IF ~ADDLIB(TOASTERLIB , 0) THEN x=Bummer(" Me No Find Toaster Library!")
  28.  
  29. if ~open(SerialOut,"SER:","a") then
  30.     do
  31.         say "Can't open serial port SER:."
  32.         exit
  33.     end
  34.  
  35. Switcher(TOSW)        /* Go to Switcher screen */
  36.  
  37. /*writech(SerialOut,x2c(StartupCmd)) */
  38.  
  39. /*say freezeframe(timecode)*/
  40.  
  41. Switcher(M001)
  42. Switcher(PDV1)
  43. Switcher(TOSW)        /* Go to Switcher screen */
  44. Switcher(LVID)        /* Set to live digital video */
  45. time(reset)
  46. do f=0 to count
  47.   Switcher(FVID)      /* Freeze frame */
  48.   SaveNextFrame(name)
  49.   Switcher(LVID)      /* Set to live digital video */
  50.   Switcher(M001)
  51.   writech(SerialOut,x2c(2b))
  52.   address command "wait 15 secs"
  53.  
  54. /*  FreezeNext() */
  55. end
  56.  
  57. Switcher(TOWB)        /* Go to Workbench screen */
  58.  
  59.  
  60. exit
  61.  
  62. /* ~~~~~~~~~~~~~~~~~~~~~ ROUTINES  ~~~~~~~~~~~~~~~~~~~` */
  63.  
  64. /* Make code like hh:mm:ss:ff into sony style bytes */
  65. MakeTC: PROCEDURE
  66.   arg TimeCode  /* Conveniently, ASCII of the hex numbers are the numbers themselves */
  67.   return space(translate(TimeCode,'',':'))||'@'
  68.  
  69. FreezeNext: PROCEDURE
  70. /*     writech(SerialOut,x2c(dfc92b))  Freeze Off, advance frame */
  71.   address command "wait 3 secs"
  72. /*     writech(SerialOut,x2c(dfcd))  Freeze frame */
  73.   address command "wait 15 secs"
  74.  
  75.      writech(SerialOut,x2c(dfca)) /* Output full frame mode */
  76.   return 1
  77.  
  78. FindFrame: PROCEDURE  EXPOSE SerialOut
  79.   arg TimeCode
  80.   if TimeCode="" then return ""
  81.   cmd=x2c(df93)
  82.   cmd=cmd||MakeTC(TimeCode)
  83.     writech(SerialOut,cmd)
  84.   address command "wait 15 secs"
  85.   return cmd
  86.  
  87. FreezeFrame: PROCEDURE  EXPOSE SerialOut
  88.   arg TimeCode
  89.   if TimeCode="" then return ""
  90.      writech(SerialOut,x2c(dfc92b)) /* Freeze Off, advance frame */
  91.   address command "wait 2 secs"
  92.   cmd=x2c(df93)
  93.   cmd=cmd||MakeTC(TimeCode)
  94.     writech(SerialOut,cmd)
  95.   address command "wait 15 secs"
  96.      writech(SerialOut,x2c(dfcd)) /* Freeze frame */
  97.   address command "wait 15 secs"
  98.      writech(SerialOut,x2c(dfca)) /* Output full frame mode */
  99.   return cmd
  100.  
  101. RecordFrame: PROCEDURE  EXPOSE SerialOut
  102.   arg TimeCode
  103.   edit_preset_cmd=x2c(dfC0)||'240@'
  104.     writeln(SerialOut,edit_preset_cmd)
  105.   in_entry_cmd=x2c(de98)||MakeTC(TimeCode)
  106.     writeln(SerialOut,in_entry_cmd)
  107.   rec_dur_cmd=x2c(df92)||'0001@'
  108.     writeln(SerialOut,rec_dur_cmd)
  109.   address command "wait 20 secs"
  110.   return cmd
  111.  
  112. RecordNextFrame: PROCEDURE  EXPOSE SerialOut
  113.   rec_dur_cmd=x2c(df92)||'0001@'
  114.     writeln(SerialOut,rec_dur_cmd)
  115.   address command "wait 15 secs"
  116.   return cmd
  117.  
  118. SaveNextFrame:  Procedure
  119.   arg name
  120.   N=Switcher(STAT,KNUM)       /* Get the current keypad number */
  121.   fs=N+1
  122.   do while Switcher(FMXI,fs) &fs~=N   /* Is the frame already there? */
  123.     if fs=999 then fs=0       /* wrap around at last frame */
  124.     else fs=fs+1
  125.   end
  126.   if fs=N then t=10        /* got to starting frame without finding open fs */
  127.   else t=Switcher(FMSV,fs,name)    /* Save frame */
  128.   say "Saved frame "name" in number "fs " at "time()
  129.   return t
  130.  
  131.  
  132.  
  133.